<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Classificados 1,99</title>
	<f:facet name="last">
		<h:outputStylesheet library="css" name="bootstrap.min.css" />
		<h:outputStylesheet library="css" name="bootstrap-theme.min.css" />

	</f:facet>
</h:head>
<h:body>
	<h:form>
		<h:panelGroup layout="block" rendered="#{principalBean.logged}">
			<h:outputLabel value="Bem vindo #{principalBean.usuario.nome}" />
			<h:commandButton action="usuario/meusanuncios?faces-redirect=true" value="Meus anúncios"> 
	             <f:attribute name="codUsuario" value="#{principalBean.usuario.codigo}" />
            </h:commandButton>
		</h:panelGroup>

		<h:panelGroup layout="block" rendered="#{!principalBean.logged}">
			<h:commandButton value="logar" action="login?faces-redirect=true"></h:commandButton>
		</h:panelGroup>
		<h:dataTable styleClass="table" value="#{principalBean.anuncios}"
			var="anuncio">
			<h:column>

				<f:facet name="header">Titulo</f:facet>			
    				#{anuncio.titulo}
    	</h:column>
			<h:column>

				<f:facet name="header">Descricao</f:facet>			
    				#{anuncio.descricao}
    	</h:column>

		</h:dataTable>
	</h:form>
	<h:outputScript name="bootstrap.min.js" library="js" />
</h:body>
</html>